package cn.itsource.configuration;


import cn.dev33.satoken.jwt.StpLogicJwtForStateless;
import cn.dev33.satoken.stp.StpLogic;
import cn.itsource.config.RedisConfig;
import cn.itsource.config.SaTokenConfigure;
import cn.itsource.config.StpInterfaceImpl;
import cn.itsource.config.TokenInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @program fccar
 * @Author luoc
 * @Date 2024/09/04 13:50
 * @Version 1.0.0
 * @Description
 */

@Configuration
@Import(RedisConfig.class)
public class AuthAutoConfiguration {

    // Sa-Token 整合 jwt (Simple 简单模式)
    @Bean
    public StpLogic getStpLogicJwt() {
        return new StpLogicJwtForStateless();
    }

    @Bean
    public SaTokenConfigure getSaTokenConfigure() {
        return new SaTokenConfigure();
    }

    @Bean
    public StpInterfaceImpl getStpInterfaceImpl(){
        return new StpInterfaceImpl();
    }

    @Bean
    public TokenInterceptor getTokenInterceptor(){
        return new TokenInterceptor();
    }
}
